home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 22 / CU Amiga Magazine's Super CD-ROM 22 (1998)(EMAP Images)(GB)[!][issue 1998-05].iso / PowerPC / System / PPCReleaseDEV / include / powerup / ppclib / tasks.i < prev   
Encoding:
Text File  |  1998-02-21  |  12.4 KB  |  524 lines

  1.     IFND POWERUP_PPCLIB_TASKS_I
  2. POWERUP_PPCLIB_TASKS_I    SET    1
  3.  
  4. ;/**************************************************
  5. ; *
  6. ; *
  7. ; *              PPCCreateTask() Tags
  8. ; *
  9. ; *
  10. ; **************************************************/
  11.  
  12. PPCTASKTAG_DUMMY    =(TAG_USER+$20000)
  13.  
  14. ;/* Program Counter Start of the Task; */
  15. PPCTASKTAG_ELFOBJECT    =(PPCTASKTAG_DUMMY+$1)
  16.  
  17. ;/* Name of the new Task.; */
  18. PPCTASKTAG_NAME        =(PPCTASKTAG_DUMMY+$2)
  19.  
  20. ;/* First Argument..gpr3; */
  21. PPCTASKTAG_ARG1        =(PPCTASKTAG_DUMMY+$3)
  22.  
  23. ;/* First Argument..gpr4; */
  24. PPCTASKTAG_ARG2        =(PPCTASKTAG_DUMMY+$4)
  25.  
  26. ;/* First Argument..gpr5; */
  27. PPCTASKTAG_ARG3        =(PPCTASKTAG_DUMMY+$5)
  28.  
  29. ;/* First Argument..gpr6; */
  30. PPCTASKTAG_ARG4        =(PPCTASKTAG_DUMMY+$6)
  31.  
  32. ;/* First Argument..gpr7; */
  33. PPCTASKTAG_ARG5        =(PPCTASKTAG_DUMMY+$7)
  34.  
  35. ;/* First Argument..gpr8; */
  36. PPCTASKTAG_ARG6        =(PPCTASKTAG_DUMMY+$8)
  37.  
  38. ;/* First Argument..gpr9; */
  39. PPCTASKTAG_ARG7        =(PPCTASKTAG_DUMMY+$9)
  40.  
  41. ;/* First Argument..gpr10; */
  42. PPCTASKTAG_ARG8        =(PPCTASKTAG_DUMMY+$a)
  43.  
  44. ;/* Default=TRUE means that the cacheflush is handled automaticly
  45. ; * You need cacheflushs when you use OS functions to share data.
  46. ; * If you know it better than the stupid cacheflush routine you
  47. ; * can handle that yourself and optimize your routines.
  48. ; */
  49.  
  50. PPCTASKTAG_CACHEFLUSH    =(PPCTASKTAG_DUMMY+$b)
  51.  
  52. ;/* Ptr to an ULONG Errorfield where a better error description
  53. ; * can be stored.
  54. ; */
  55.  
  56. PPCTASKTAG_ERROR    =(PPCTASKTAG_DUMMY+$c)
  57.  
  58. ;/* PPC Stacksize...Default 8192;
  59. ; * Supported by PowerUP's PPCGetTaskAttr() (V45)
  60. ; */
  61. PPCTASKTAG_STACKSIZE    =(PPCTASKTAG_DUMMY+$d)
  62.  
  63. ;/* Task Priority..Default 0; */
  64. PPCTASKTAG_PRIORITY    =(PPCTASKTAG_DUMMY+$e)
  65.  
  66. ;/* Input Handle..Default Open("Nil:")
  67. ; * The handle is closed when the PPC task completes
  68. ; */
  69. PPCTASKTAG_INPUTHANDLE    =(PPCTASKTAG_DUMMY+$f)
  70.  
  71. ;/* Output Handle..Default Open("Nil:")
  72. ; * The handle is closed when the PPC task completes
  73. ; */
  74. PPCTASKTAG_OUTPUTHANDLE    =(PPCTASKTAG_DUMMY+$10)
  75.  
  76. ;/* Error Handle..Default Open("Nil:")
  77. ; * The handle is closed when the PPC task completes
  78. ; */
  79. PPCTASKTAG_ERRORHANDLE    =(PPCTASKTAG_DUMMY+$11)
  80.  
  81. ;/*
  82. ; * When you set this Tag the Task is stopped
  83. ; * before the first instruction is executed
  84. ; * Only useful for debuggers
  85. ; */
  86. PPCTASKTAG_STOPTASK    =(PPCTASKTAG_DUMMY+$12)
  87.  
  88. ;/* ExceptionHook
  89. ; * The M68k Hook is called when a PPC TaskObject gets an
  90. ; * exception which can be processor or software(Kernel Msg)
  91. ; * related.
  92. ; * That`s the way the ppc.library calls the Hook:
  93. ; *
  94. ; * BOOL CallHookPkt(hook,TaskObject,ExceptionMsg);
  95. ; *
  96. ; * The Hook Function is NOT allowed to call PPCLibBase
  97. ; * functions to avoid deadlocks.
  98. ; * And after the Hook function returns the ExceptionMsg
  99. ; * contents IS NOT valid anymore.
  100. ; * So you should copy the ExceptionMsg contents to a private
  101. ; * buffer and then signal your debugger control task about
  102. ; * the event.
  103. ; * The Hook return BOOL should tell the ppc.library if all
  104. ; * worked fine.
  105. ; */
  106.  
  107. PPCTASKTAG_EXCEPTIONHOOK    =(PPCTASKTAG_DUMMY+$13)
  108.  
  109. ;/* If you want that the PPCPort gets a MsgPort you can tell
  110. ; * PPCCreateTask by a TRUE that you want one.
  111. ; * I made this optional because it may cause an initial speed
  112. ; * loss if you only need a ppc task for a quick run job where
  113. ; * the init latency may be a serious issue.
  114. ; * Supported by PowerUP's PPCGetTaskAttr()
  115. ; */
  116. PPCTASKTAG_MSGPORT        =(PPCTASKTAG_DUMMY+$14)
  117.  
  118. ;/* If you wanna provide the ppc a startup msg. This msg will
  119. ; * be replied by the ppc.library after the PPC Task ends so
  120. ; * you can use this to abitrate your PPCUnloadObject()
  121. ; * Supported by PowerUP's PPCGetTaskAttr()
  122. ; */
  123. PPCTASKTAG_STARTUP_MSG        =(PPCTASKTAG_DUMMY+$15)
  124. ;/* The Data field for the PPCMessage
  125. ; * Supported by PowerUP's PPCGetTaskAttr()
  126. ; */
  127. PPCTASKTAG_STARTUP_MSGDATA    =(PPCTASKTAG_DUMMY+$16)
  128. ;/* The Length field for the PPCMessage
  129. ; * Supported by PowerUP's PPCGetTaskAttr()
  130. ; */
  131. PPCTASKTAG_STARTUP_MSGLENGTH    =(PPCTASKTAG_DUMMY+$17)
  132. ;/* The MsgID field for the PPCMessage
  133. ; * Supported by PowerUP's PPCGetTaskAttr()
  134. ; */
  135. PPCTASKTAG_STARTUP_MSGID    =(PPCTASKTAG_DUMMY+$18)
  136. ;/* The flag to activate the CTRL-C;D;E;F gateway to
  137. ; * the PPC Task by PPCSendSignal();
  138. ; */
  139. PPCTASKTAG_BREAKSIGNAL        =(PPCTASKTAG_DUMMY+$19)
  140.  
  141.  
  142. ;/* Run Task Synchron Flag which means that the PPCCreateTask
  143. ; * doesn`t return until the task completes and the return
  144. ; * value is not the TaskObject but the Task`s return value.
  145. ; * To check if the task runned correctly check out the
  146. ; * PPCTASKTAG_ERROR fieldptr.
  147. ; * With this Tag you can do the same what the old RunTaskObject
  148. ; * does which interface is a bit limited(compatibility to the
  149. ; * first ppc.library version)
  150. ; */
  151.  
  152. PPCTASKTAG_WAITFINISH    =(PPCTASKTAG_DUMMY+$31)
  153.  
  154. ;/* 
  155. ; * PPCTAGTAG_ERROR types
  156. ; */
  157.  
  158. ERROR_OK        =0
  159. ERROR_MEMORY        =1
  160. ERROR_NOPC        =2
  161. ERROR_CREATEMSGINTASK    =3
  162. ERROR_INPUTHANDLE    =4
  163. ERROR_OUTPUTHANDLE    =5
  164. ERROR_ERRORHANDLE    =6
  165.  
  166.  
  167.  
  168.  
  169. ;/**************************************************
  170. ; *
  171. ; *
  172. ; *             PPCGetTaskInfo() Tags
  173. ; *
  174. ; *
  175. ; **************************************************/
  176.  
  177. ;/*
  178. ; * V45 adds the ti_Data data Set/Get passing if it`s possible
  179. ; */
  180.  
  181. PPCTASKINFOTAG_DUMMY        =(TAG_USER+$21000)
  182. PPCTASKINFOTAG_NAME        =(PPCTASKINFOTAG_DUMMY+$1)
  183. PPCTASKINFOTAG_PRIORITY        =(PPCTASKINFOTAG_DUMMY+$2)
  184. PPCTASKINFOTAG_CACHEFLUSH    =(PPCTASKINFOTAG_DUMMY+$3)
  185. PPCTASKINFOTAG_STACKSIZE    =(PPCTASKINFOTAG_DUMMY+$4)
  186. PPCTASKINFOTAG_STATE        =(PPCTASKINFOTAG_DUMMY+$5)
  187. PPCTASKINFOTAG_TASK        =(PPCTASKINFOTAG_DUMMY+$6)
  188.  
  189. ;/* This means the HOOK function is called for every Task; */
  190. PPCTASKINFOTAG_ALLTASK        =(PPCTASKINFOTAG_DUMMY+$7)
  191.  
  192. ;/* Hook function which is called for a task so you can ask special fields
  193. ; * you may want to use.
  194. ; * Msg Parameter is NULL for now.
  195. ; * Object Parameter is the TaskObject
  196. ; *
  197. ; *    HookFunc(Hook, TaskObject, NULL)
  198. ; */
  199. PPCTASKINFOTAG_HOOK        =(PPCTASKINFOTAG_DUMMY+$8)
  200.  
  201. PPCTASKINFOTAG_SIGALLOC        =(PPCTASKINFOTAG_DUMMY+$9)
  202. PPCTASKINFOTAG_SIGWAIT        =(PPCTASKINFOTAG_DUMMY+$a)
  203. PPCTASKINFOTAG_SIGRECVD        =(PPCTASKINFOTAG_DUMMY+$b)
  204. PPCTASKINFOTAG_USEDSTACKSIZE    =(PPCTASKINFOTAG_DUMMY+$c)
  205. PPCTASKINFOTAG_INPUTHANDLE    =(PPCTASKINFOTAG_DUMMY+$d)
  206. PPCTASKINFOTAG_OUTPUTHANDLE    =(PPCTASKINFOTAG_DUMMY+$e)
  207. PPCTASKINFOTAG_ERRORHANDLE    =(PPCTASKINFOTAG_DUMMY+$f)
  208.  
  209. ;/* Return the ElfObject of a Task
  210. ; * (Get)
  211. ; * (V45)
  212. ; */
  213.  
  214. PPCTASKINFOTAG_ELFOBJECT        =(PPCTASKINFOTAG_DUMMY+$10)
  215.  
  216. ;/* See equal PPCTASKTAG_EXCEPTIONHOOK
  217. ; * (V45)
  218. ; * (Set)
  219. ; */
  220.  
  221. PPCTASKINFOTAG_EXCEPTIONHOOK        =(PPCTASKINFOTAG_DUMMY+$11)
  222.  
  223. ;/* Tell the task to stop at the first instruction.
  224. ; * Only allowed to be used when you get a TaskHookMsg
  225. ; * with the MethodID PPCTASKHOOKMETHOD_CREATE.
  226. ; * It must not be called while a PPC Task runs.
  227. ; * (V45)
  228. ; * (Set)
  229. ; */
  230. PPCTASKINFOTAG_STOPTASK            =(PPCTASKINFOTAG_DUMMY+$12)
  231.  
  232.  
  233. ;/* See equal PPCTASKTAG_MSGPORT
  234. ; * (V45)
  235. ; */
  236. PPCTASKINFOTAG_MSGPORT            =(PPCTASKINFOTAG_DUMMY+$13)
  237.  
  238. ;/* See equal PPCTASKTAG_STARTUP_MSG
  239. ; * (V45)
  240. ; */
  241. PPCTASKINFOTAG_STARTUP_MSG        =(PPCTASKINFOTAG_DUMMY+$14)
  242.  
  243. ;/* See equal PPCTASKTAG_STARTUP_MSGDATA
  244. ; * (V45)
  245. ; */
  246. PPCTASKINFOTAG_STARTUP_MSGDATA        =(PPCTASKINFOTAG_DUMMY+$15)
  247.  
  248. ;/* See equal PPCTASKTAG_STARTUP_MSGLENGTH
  249. ; * (V45)
  250. ; */
  251. PPCTASKINFOTAG_STARTUP_MSGLENGTH    =(PPCTASKINFOTAG_DUMMY+$16)
  252.  
  253. ;/* See equal PPCTASKTAG_STARTUP_MSGID
  254. ; * (V45)
  255. ; */
  256. PPCTASKINFOTAG_STARTUP_MSGID        =(PPCTASKINFOTAG_DUMMY+$17)
  257.  
  258. ;/*
  259. ; * All Register Tags only accept Ptrs at ti_Data so I don`t have to
  260. ; * change the API when there`s a 64Bit PPC some time.
  261. ; */
  262.  
  263. ;/* SRR0=PC;
  264. ; * Get/Set through ti_Data or PPCTASKINFOTAG_VALUEPTR
  265. ; * (Get/Set)
  266. ; */
  267. PPCTASKINFOTAG_PC        =(PPCTASKINFOTAG_DUMMY+$20)
  268. ;/* SRR1=MSR;
  269. ; * Get/Set through ti_Data or PPCTASKINFOTAG_VALUEPTR
  270. ; * (Get/Set)
  271. ; */
  272. PPCTASKINFOTAG_MSR        =(PPCTASKINFOTAG_DUMMY+$21)
  273.  
  274. ;/* 32bit value in function Result;
  275. ; * Get/Set through ti_Data
  276. ; * (Get/Set)
  277. ; */
  278. PPCTASKINFOTAG_CR        =(PPCTASKINFOTAG_DUMMY+$22)
  279.  
  280. ;/* 32bit value in function Result;
  281. ; * Get/Set through ti_Data
  282. ; * (Get/Set)
  283. ; */
  284. PPCTASKINFOTAG_XER        =(PPCTASKINFOTAG_DUMMY+$23)
  285.  
  286. ;/* Result by PPCTASKINFOTAG_VALUEPTR;
  287. ; * Get/Set through ti_Data or PPCTASKINFOTAG_VALUEPTR
  288. ; * (Get/Set)
  289. ; */
  290. PPCTASKINFOTAG_LR        =(PPCTASKINFOTAG_DUMMY+$24)
  291.  
  292. ;/* Result by PPCTASKINFOTAG_VALUEPTR;
  293. ; * Get/Set through ti_Data or PPCTASKINFOTAG_VALUEPTR
  294. ; * (Get/Set)
  295. ; */
  296.  
  297. PPCTASKINFOTAG_CTR        =(PPCTASKINFOTAG_DUMMY+$25)
  298.  
  299. ;/* Result by PPCTASKINFOTAG_VALUEPTR;
  300. ; * Get/Set through ti_Data or PPCTASKINFOTAG_VALUEPTR
  301. ; * (Get/Set)
  302. ; */
  303. PPCTASKINFOTAG_FPSCR        =(PPCTASKINFOTAG_DUMMY+$26)
  304.  
  305. ;/* ti_Data=Register Number
  306. ; * Get/Set through PPCTASKINFOTAG_VALUEPTR
  307. ; * (Get/Set)
  308. ; */
  309. PPCTASKINFOTAG_GPR        =(PPCTASKINFOTAG_DUMMY+$30)
  310.  
  311. ;/* ti_Data=Register Number
  312. ; * Get/Set through PPCTASKINFOTAG_VALUEPTR
  313. ; * (Get/Set)
  314. ; */
  315. PPCTASKINFOTAG_FPR        =(PPCTASKINFOTAG_DUMMY+$31)
  316.  
  317. ;/* Address where to read/write the register value from.
  318. ; * I use a ptr to be size indepent with the registers
  319. ; */
  320. PPCTASKINFOTAG_VALUEPTR        =(PPCTASKINFOTAG_DUMMY+$32)
  321.  
  322.  
  323. ;/* With PPCTASKINFOTAG_WAITFINISHTASK
  324. ; * it returns the parent process in which you created
  325. ; * a synchron PPC Task. Synchron PPC Task`s are created
  326. ; * with the PPCTASKTAG_WAITINFISH,TRUE or outdated a
  327. ; * PPCRunObject.
  328. ; * The reason for this function is to find the shell
  329. ; * task easily and check for a CTRL-C for example.
  330. ; * (Get)
  331. ; * (V45)
  332. ; */
  333. PPCTASKINFOTAG_WAITFINISHTASK    =(PPCTASKTAG_DUMMY+$33)
  334.  
  335.  
  336.  
  337.  
  338. ;/**************************************************
  339. ; *
  340. ; *
  341. ; *           TaskObject ExceptionHook
  342. ; *
  343. ; *
  344. ; **************************************************/
  345.  
  346.  
  347.     STRUCTURE    ExceptionMsg,0
  348.     ULONG            Version;
  349.     ULONG            Type;
  350.     STRUCT            GPR,32*4;
  351.     STRUCT            FPR,32*8;
  352.     STRUCT            SR,16*4;
  353.     ULONG            CR;
  354.     DOUBLE            FPSCR;
  355.     ULONG            XER;
  356.     ULONG            LR;
  357.     ULONG            CTR;
  358.     ULONG            PVR;
  359.     ULONG            IBAT0U;
  360.     ULONG            IBAT0L;
  361.     ULONG            IBAT1U;
  362.     ULONG            IBAT1L;
  363.     ULONG            IBAT2U;
  364.     ULONG            IBAT2L;
  365.     ULONG            IBAT3U;
  366.     ULONG            IBAT3L;
  367.  
  368.     ULONG            DBAT0U;
  369.     ULONG            DBAT0L;
  370.     ULONG            DBAT1U;
  371.     ULONG            DBAT1L;
  372.     ULONG            DBAT2U;
  373.     ULONG            DBAT2L;
  374.     ULONG            DBAT3U;
  375.     ULONG            DBAT3L;
  376.  
  377.     ULONG            SDR1;
  378.     ULONG            ASR;
  379.  
  380.     ULONG            DAR;
  381.     ULONG            DSISR;
  382.     ULONG            SRR0;
  383.     ULONG            SRR1;
  384.  
  385.     ULONG            SPRG0;
  386.     ULONG            SPRG1;
  387.     ULONG            SPRG2;
  388.     ULONG            SPRG3;
  389.  
  390.     ULONG            TBL;
  391.     ULONG            TBU;
  392.     ULONG            DEC;
  393.     ULONG            DABR;
  394.  
  395.     ;/* 603 special registers; */
  396.  
  397.     ULONG            DMISS;
  398.     ULONG            DCMP;
  399.     ULONG            HASH1;
  400.     ULONG            HASH2;
  401.     ULONG            IMISS;
  402.     ULONG            ICMP;
  403.     ULONG            RPA;
  404.  
  405.     ;/* 604e special registers; */
  406.  
  407.     ;/* Version 0 ends here; */
  408.  
  409.     ULONG            MSR;
  410.  
  411.     ;/* Version 1 ends here */
  412.  
  413.     ;/* Size depends on Version; */
  414.  
  415.  
  416. ;/* Current supported Version
  417. ; */
  418.  
  419. EXCEPTIONMSG_VERSION    =    1
  420.  
  421. ;/*
  422. ; * Current supported Types
  423. ; */
  424.  
  425. ;/*
  426. ; * These are the processor exceptions
  427. ; */
  428.  
  429. EXCEPTION_UNKNOWN        =0    ;/* Won`t happen; */
  430. EXCEPTION_RESET            =1    ;/* Won`t happen; */
  431. EXCEPTION_MACHINECHECK        =2    ;/* Won`t happen; */
  432. EXCEPTION_DATAACCESS        =3
  433. EXCEPTION_INSTRUCTIONACCESS    =4
  434. EXCEPTION_EXTERNALINTERRUPT    =5    ;/* Won`t happen; */
  435. EXCEPTION_ALIGNMENT        =6
  436. EXCEPTION_PROGRAM        =7
  437. EXCEPTION_FPUUNAVAILABLE    =8
  438. EXCEPTION_DECREMENTER        =9
  439. EXCEPTION_INTERFACEERROR    =10
  440. EXCEPTION_RESERVED_B        =11
  441. EXCEPTION_SYSTEMCALL        =12
  442. EXCEPTION_TRACE            =13
  443. EXCEPTION_FPUASSIST        =14
  444. EXCEPTION_RESERVED_F        =15
  445. EXCEPTION_IMISS            =16
  446. EXCEPTION_DLOADMISS        =17
  447. EXCEPTION_DSTOREMISS        =18
  448. EXCEPTION_IADDRESSBREAK        =19
  449. EXCEPTION_SYSTEMMANAGEMENTINT    =20
  450.  
  451.  
  452. ;/*
  453. ; * These are the kernel exceptions
  454. ; * to signal certain events
  455. ; */
  456.  
  457. EXCEPTION_MSG            =$80000000
  458.  
  459. ;/*
  460. ; * You receive this exception type
  461. ; * when the Kernel could stop a Task
  462. ; * successfully after a Stop or Trace
  463. ; * operation.
  464. ; * Look at PPCTASKTAG_STOPTASK for example
  465. ; */
  466.  
  467. EXCEPTION_STOPTASK        =(EXCEPTION_MSG+$0)
  468.  
  469. ;/*
  470. ; * You receive this exception type
  471. ; * when the task completes.
  472. ; * In this case the ONLY valid fields in the
  473. ; * ExceptionMsg are the Version field and the
  474. ; * the Message type.
  475. ; */
  476.  
  477. EXCEPTION_FINISHTASK        =(EXCEPTION_MSG+$1)
  478.  
  479.  
  480. ;/**************************************************
  481. ; *
  482. ; *
  483. ; *              PPCStartTask() Tags
  484. ; *
  485. ; *
  486. ; **************************************************/
  487.  
  488. PPCTASKSTARTTAG_DUMMY        =(TAG_USER+$22000)
  489.  
  490. ;/* Just run a Task again
  491. ; * ti_Data=BOOL
  492. ; */
  493. PPCTASKSTARTTAG_RUN        =(PPCTASKSTARTTAG_DUMMY+$0)
  494.  
  495. ;/* Single Step the next instruction
  496. ; * ti_Data=BOOL
  497. ; */
  498. PPCTASKSTARTTAG_TRACE        =(PPCTASKSTARTTAG_DUMMY+$1)
  499.  
  500. ;/* Branch until a Trace instruction
  501. ; * Processor dependent
  502. ; * ti_Data=BOOL
  503. ; * NOT SUPPORTED YET
  504. ; */
  505. PPCTASKSTARTTAG_BRANCHTRACE    =(PPCTASKSTARTTAG_DUMMY+$2)
  506.  
  507. ;/* Run until Instruction hit
  508. ; * the Breakpoint Address
  509. ; * Processor dependent
  510. ; * ti_Data=BOOL
  511. ; * NOT SUPPORTED YET
  512. ; */
  513. PPCTASKSTARTTAG_IBREAK        =(PPCTASKSTARTTAG_DUMMY+$3)
  514.  
  515. ;/* Run until DataAccess hit
  516. ; * the Breakpoint Address
  517. ; * Processor dependent
  518. ; * ti_Data=BOOL
  519. ; * NOT SUPPORTED YET
  520. ; */
  521. PPCTASKSTARTTAG_DBREAK        =(PPCTASKSTARTTAG_DUMMY+$4)
  522.  
  523.     ENDC
  524.